/*j5Rddi+EiXr6lL+2HQtAzX3iX6xjsXo5+wndSB4zB+qKTTH561VynipMFBlIa3yX*/
/*
 * @Author: xiahui 
 * @PageInfo: 复制 
 * @Date: 2019-02-20 09:20:12 
 * @Last Modified by: liangzhyf
 * @Last Modified time: 2019-08-26 15:24:50
 */
import { ajax } from 'nc-lightapp-front';
import { AREA, URL, FIELDS, UISTATUS } from '../../constance';
import { setCardPage } from '../../utils/cardPageUtil';

export default function(props, pk) {
	
	pk = pk ? pk : props.form.getFormItemsValue(AREA.cardFormId, FIELDS.pk_ct_pu).value;
	ajax({
		url: URL.copy,
		data: {
			pk: pk
		},
		success: (res) => {
			if (res.success && res.data) {
				props.setUrlParam({
					status: UISTATUS.copy,
					id: pk
				});
				setCardPage.call(this, props, res.data, false, false);	
				//复制时将累计发送邮件次数设置为0
				props.form.setFormItemsValue(AREA.cardFormId, {
					[FIELDS.sendemailcount]: {value:'0',display:false}
				});			
				props.form.setFormItemsDisabled(AREA.cardFormId, {
					[FIELDS.ctrantypeid]: false
				});
			}
		}
	});
}

/*j5Rddi+EiXr6lL+2HQtAzX3iX6xjsXo5+wndSB4zB+qKTTH561VynipMFBlIa3yX*/